Open
Conversation
This correctly detects subdomains with DNSLink name inlined into a single DNS label. More details: ipfs/in-web-browsers#169 License: MIT Signed-off-by: Marcin Rataj <lidel@lidel.org>
- Fixes ipfs-shipyard#48
…domains' into feat/add-iana-ipfs
SgtPooki
suggested changes
May 8, 2024
| @@ -0,0 +1,182 @@ | |||
| 'use strict' | |||
Member
There was a problem hiding this comment.
this file shouldn't be committed here. might have been extra from a manual tsc run?
|
|
||
| isIPFS.ipfsUrl('https://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true | ||
| isIPFS.ipfsUrl('https://ipfs.io/ipfs/invalid-hash') // false | ||
| isIPFS.ipfsUrl('ipfs://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true |
Member
There was a problem hiding this comment.
Suggested change
| isIPFS.ipfsUrl('ipfs://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true | |
| isIPFS.ipfsUrl('ipfs://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // false |
this should return as invalid since it should have a CID as the "domain" when "ipfs" is the protocol
|
|
||
| isIPFS.ipnsUrl('https://ipfs.io/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // false | ||
| isIPFS.ipnsUrl('https://ipfs.io/ipns/github.com') // true | ||
| isIPFS.ipnsUrl('ipns://ipfs.io/ipns/github.com') // true |
Member
There was a problem hiding this comment.
This should return as true because ipfs.io might reference a valid dnslink, but the /ipns/<domain> might confuse users. we should remove this, or just use ipns://<validDnsLink>
also we should probably show invalid here:
- ipns://CID is invalid
- ipns:// is invalid
- ipns:// is invalid
|
|
||
| describe('ipns path', () => { | ||
| it('isIPFS.urlOrPath should match an IANA-schema compliant ipns url', () => { | ||
| expect(isIPFS.urlOrPath('ipns://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm')).to.be.true() |
Member
There was a problem hiding this comment.
Suggested change
| expect(isIPFS.urlOrPath('ipns://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm')).to.be.true() | |
| expect(isIPFS.urlOrPath('ipns://QmYHNYAaYK5hm3ZhZFx5W9H6xydKDGimjdgJMrMSdnctEm')).to.be.false() |
ipns:// is not valid. Only keys and domains are valid.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.